package com.marion.jpa.query;

import com.marion.jpa.common.criteria.dynamic01.BaseQuery;
import com.marion.jpa.common.criteria.dynamic01.MatchType;
import com.marion.jpa.common.criteria.dynamic01.QueryCondition;
import com.marion.jpa.common.criteria.dynamic02.QueryParams01;
import com.marion.jpa.entity.TUserEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.jpa.domain.Specification;

/**
 * @author Marion
 * @date 2022/3/2 15:11
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@Builder
public class UserSearchQuery002 extends BaseQuery<TUserEntity> {

    @QueryCondition(func = MatchType.equal)
    private String name;

    @QueryCondition(func = MatchType.equal)
    private Integer gender;

    /**
     * 将查询转换成Specification
     */
    @Override
    public Specification<TUserEntity> toSpec() {
        return super.toSpecWithAnd();
    }

}
